# Maintainer:  Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer:  Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Contributor: Thorsten Töpper <atsutane-tu@freethoughts.de>

pkgname=vnstat
pkgver=2.10
pkgrel=1
pkgdesc="A console-based network traffic monitor"
arch=('loong64' 'x86_64')
url="https://humdi.net/vnstat/"
license=('GPL')
depends=('bash' 'sqlite')
makedepends=('gd')
optdepends=('gd: image output')
backup=(etc/vnstat.conf)
source=(https://humdi.net/vnstat/$pkgname-$pkgver.tar.gz{,.asc})
sha256sums=('a9c61744e5cd8c366e2db4d282badc74021ddb614bd65b41240937997e457d25'
            'SKIP')
validpgpkeys=(23EF1DD76E65248FB055201ADAFE84E63D140114) # Teemu Toivola

build() {
  cd "$srcdir"/$pkgname-$pkgver
  ./configure --prefix=/usr --sbindir=/usr/bin --sysconfdir=/etc
  make
}

package() {
  cd "$srcdir"/$pkgname-$pkgver
  mkdir -p "$pkgdir"/usr/bin
  make DESTDIR="$pkgdir" install
  install -Dm0755 examples/vnstat.cgi "$pkgdir"/usr/share/doc/vnstat/examples/vnstat.cgi
  install -Dm0644 examples/systemd/vnstat.service "$pkgdir"/usr/lib/systemd/system/vnstat.service
}
